﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Core.DMS
{
    public class FileSystemObject
    {
        protected int _id = -1;
        protected int _parent = -1;
        protected string _title = "";

        public int ID { get { return _id;} }
        public int Parent { get { return _parent; } set { _parent = value;} }
        public string Title { get { return _title; } set { _title = value;} }

        public string Path
        {
            get
            {
                if (ID != -1)
                    return Folder.Get(Parent).Path + "/" + Title;
                return "";
            }
        }

        public FileSystemObject(int Parent, string Title)
        {
            _parent = Parent;
            _title = Title;
        }

        public FileSystemObject(IDataReader data)
        {
            _id = (int)data["id"];
            _parent = (int)data["parent"];
            _title = (string)data["title"];
        }
    }
}
